package com.adtech.adms.order.capitek;

import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.om.OMText;

public class ResponseMessage {
	private String code;
	private String msg;

	private ResponseMessage() {

	}

	public ResponseMessage(String code, String msg) {
		this.code = code;
		this.msg = msg;
	}

	public OMElement getResponse() {
		OMFactory soapFactory = OMAbstractFactory.getOMFactory();
		
		OMNamespace omNs = soapFactory.createOMNamespace(
				Constants.NAME_SPACE_URI, Constants.NAME_SPACE_PREFIX);

		OMElement soapResponse = soapFactory.createOMElement("SoapResponse",omNs);

		OMElement soapIssuer = soapFactory.createOMElement("ret_code", omNs);

		soapIssuer.setText(code);

		soapResponse.addChild(soapIssuer);

		OMElement soapSerial = soapFactory.createOMElement("ret_msg", omNs);

		soapSerial.setText(msg);

		soapResponse.addChild(soapSerial);

		soapResponse.build();
		return soapResponse;
	}
}
